<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/9
 * Time: 18:25
 */
class Circla{
    private  $r;
    private  $d='abc';
    public function  getArea(){
        return $this->r*$this->r*3.14;
    }
    public  function  __set($name, $value)
    {
    if($name=='r'&& $value<0){
        $this->r=0;

    }else{
        $this->r=$value;

    }
    // TODO: Implement __set() method.
}
    public  function  __get($name)
    {
        if($name=='r'){
            return $this->$name;
        }
    }
    public  function __clone()
    {
     $this->r=10;
        // TODO: Implement __clone() method.
    }
    public  function __toString()
    {
     return "圆的半径".$this->r;
        // TODO: Implement __toString() method.
    }
    public  function  __call( $arguments,$name)
    {
        die( "不存在".$arguments);
        // TODO: Implement __call() method.
    }
    public  function  _sleep(){
        return array("r111");

    }
}

/*
$c=new Circla();
$c->r=3;
print $c->getArea();
var_dump($c);
print '<br/>';
$cc=clone  $c;
print '<br/>';
$cc->getArea();
var_dump($cc);
print '<br/>';
print $c;
print '<br/>';
print $c->getArea2();*/
$c=new Circla(3);
var_dump($c);
echo  "<br/>";
$str=serialize($c);
echo $str;
echo  "<br/>";
$d=unserialize($str);
var_dump($d);